//
//  CYDetailViewController.swift
//  CYWeibo
//
//  Created by 媛 on 16/5/22.
//  Copyright © 2016年 yuan. All rights reserved.
//

import UIKit

class CYDetailViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        //设置背景颜色
        view.backgroundColor = UIColor.whiteColor()
        
        //MARK: bug：使用自定义按钮后，返回按钮的“边缘返回手势”丢失
        //解决方法：在导航控制器中重新设置边缘返回手势的代理
        //设置自定义返回按钮
//        let back = UIBarButtonItem(imageName: "navigationbar_back_withtext", title: "返回", target: self, action: #selector(CYDetailViewController.backBtnClick))
//        self.navigationItem.leftBarButtonItem = back
        
        //进入多级页面
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Next", style: .Plain, target: self, action: #selector(nexrBtnClick))
        self.title = "\(navigationController?.childViewControllers.count ?? 0)"
    
    }
    
//    @objc private func backBtnClick() {
//        //pop：销毁当前控制器
//        navigationController?.popViewControllerAnimated(true)
//    }

    @objc private func nexrBtnClick() {
    
        let nextVC = CYDetailViewController()
        navigationController?.pushViewController(nextVC, animated: true)
    }

}
